home *** CD-ROM | disk | FTP | other *** search
- #include "PostPre.h"
- #include "PostWin.h"
- #include "Global.h"
-
- int init_selected=0, max_selected=-1;
- struct Node *node_selected = NULL;
-
- struct Node *get_node(void)
- {
- struct Node *node;
- int i;
-
- node = TempOptions.startuplist.lh_Head;
- for(i=0; i < init_selected; i++)
- {
- node = node->ln_Succ;
- }
- return(node);
- }
-
- int OptWidthClicked( void )
- {
- /* routine when gadget "_Width" is clicked. */
-
- TempOptions.PostOpts.width = GetNumber(OptionsGadgets[GD_OptWidth]);
- return(0);
- }
-
- int OptHeightClicked( void )
- {
- /* routine when gadget "Height" is clicked. */
-
- TempOptions.PostOpts.height = GetNumber(OptionsGadgets[GD_OptHeight]);
- return(0);
- }
-
- int OptXOffClicked( void )
- {
- /* routine when gadget "XOffset" is clicked. */
-
- TempOptions.PostOpts.xoff = GetNumber(OptionsGadgets[GD_OptXOff]);
- return(0);
- }
-
- int OptYOffClicked( void )
- {
- /* routine when gadget "YOffset" is clicked. */
-
- TempOptions.PostOpts.yoff = GetNumber(OptionsGadgets[GD_OptYOff]);
- return(0);
- }
-
- int OptXDPIClicked( void )
- {
- /* routine when gadget "XDPI" is clicked. */
-
- TempOptions.PostOpts.xdpi = GetNumber(OptionsGadgets[GD_OptXDPI]);
- return(0);
- }
-
- int OptYDPIClicked( void )
- {
- /* routine when gadget "YDPI" is clicked. */
-
- TempOptions.PostOpts.ydpi = GetNumber(OptionsGadgets[GD_OptYDPI]);
- return(0);
- }
-
- int OptStartUpClicked( void )
- {
- /* routine when gadget "_Startup File(s)" is clicked. */
-
- init_selected = OptionsMsg.Code;
- node_selected = get_node();
- /* sprintf(undobuff, "init = %d, max = %d, node = %lx",
- init_selected, max_selected, node_selected);
- okmsg(undobuff);*/
- return(0);
- }
-
- int OptNewClicked( void )
- {
- /* routine when gadget "_New" is clicked. */
-
- struct startupnode *startupnode;
-
- /* sprintf(undobuff, "head = %lx, tail = %lx tailpred = %lx",
- TempOptions.startuplist.lh_Head, TempOptions.startuplist.lh_Tail,
- TempOptions.startuplist.lh_TailPred);
- okmsg(undobuff);
- sprintf(undobuff, "init = %d, max = %d, node = %lx",
- init_selected, max_selected, node_selected);
- okmsg(undobuff);*/
-
- if (AslRequestTags(fontrequester,
- ASLFR_InitialPattern, (ULONG) "",
- ASLFR_InitialDrawer, (ULONG) "POST:",
- ASLFR_InitialFile, (ULONG) "",
- ASLFR_InitialHeight, 300,
- ASLFR_TitleText, (ULONG) "Select new init-file",
- ASLFR_DoSaveMode, FALSE,
- ASLFR_Window, (ULONG) OutputWnd,
- TAG_DONE) == NULL) return(0);
- strcpy(undobuff, fontrequester->rf_Dir);
- if(AddPart(undobuff, fontrequester->rf_File, MAXFILENAME) == FALSE) return(0);
- if(startupnode = (struct startupnode *) malloc(sizeof(struct startupnode)))
- {
- strcpy(startupnode->name, undobuff);
- startupnode->linknode.ln_Name = startupnode->name;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptStartUp], OptionsWnd, NULL,
- GTLV_Labels, ~0, TAG_DONE);
- Insert(&TempOptions.startuplist, (struct Node *) startupnode, node_selected);
- }
- init_selected++;
- max_selected++;
- node_selected = get_node();
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptStartUp], OptionsWnd, NULL,
- GTLV_Labels, (ULONG) &(TempOptions.startuplist), GTLV_Selected, init_selected, GTLV_Top, init_selected, TAG_DONE);
- return(0);
- }
-
- int OptDelClicked( void )
- {
- /* routine when gadget "_Del" is clicked. */
-
- /* sprintf(undobuff, "head = %lx, tail = %lx tailpred = %lx",
- TempOptions.startuplist.lh_Head, TempOptions.startuplist.lh_Tail,
- TempOptions.startuplist.lh_TailPred);
- okmsg(undobuff);
- sprintf(undobuff, "init = %d, max = %d, node = %lx",
- init_selected, max_selected, node_selected);
- okmsg(undobuff);*/
- if(max_selected == -1)
- {
- /* okmsg("nothing to delete");*/
- return(0);
- }
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptStartUp], OptionsWnd, NULL,
- GTLV_Labels, ~0, TAG_DONE);
- Remove(node_selected);
- free(node_selected);
- /* okmsg("node freed");
- sprintf(undobuff, "head = %lx, tail = %lx tailpred = %lx",
- TempOptions.startuplist.lh_Head, TempOptions.startuplist.lh_Tail,
- TempOptions.startuplist.lh_TailPred);
- okmsg(undobuff);*/
- if(init_selected == max_selected) init_selected--;
- max_selected--;
- node_selected = get_node();
- /* sprintf(undobuff, "init = %d, max = %d, node = %lx",
- init_selected, max_selected, node_selected);
- okmsg(undobuff);*/
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptStartUp], OptionsWnd, NULL,
- GTLV_Labels, (ULONG) &(TempOptions.startuplist), GTLV_Selected, init_selected, GTLV_Top, init_selected, TAG_DONE);
- return(0);
- }
-
- int OptFontsClicked( void )
- {
- /* routine when gadget "Fonts" is clicked. */
-
- TempOptions.PostOpts.fonts = GetNumber(OptionsGadgets[GD_OptFonts]);
- return(0);
- }
-
- int OptHtoneClicked( void )
- {
- /* routine when gadget "Htone" is clicked. */
-
- TempOptions.PostOpts.htone = GetNumber(OptionsGadgets[GD_OptHtone]);
- return(0);
- }
-
- int OptVMClicked( void )
- {
- /* routine when gadget "VM" is clicked. */
-
- TempOptions.PostOpts.vm = GetNumber(OptionsGadgets[GD_OptVM]);
- return(0);
- }
-
- int OptPathsClicked( void )
- {
- /* routine when gadget "Paths" is clicked. */
-
- TempOptions.PostOpts.paths = GetNumber(OptionsGadgets[GD_OptPaths]);
- return(0);
- }
-
- int OptSaveClicked( void )
- {
- /* routine when gadget "_Save" is clicked. */
-
- SavePostOptions(saveopts[opt_number], &TempOptions);
- SavePostOptions(useopts[opt_number], &TempOptions);
- return(Options_OK);
- }
-
- int OptUseClicked( void )
- {
- /* routine when gadget "_Use" is clicked. */
-
- SavePostOptions(useopts[opt_number], &TempOptions);
- return(Options_OK);
- }
-
- int OptCancelClicked( void )
- {
- /* routine when gadget "_Cancel" is clicked. */
-
- return(Options_CANCEL);
- }
-
- int OptColorClicked( void )
- {
- /* routine when gadget "" is clicked. */
-
- switch(OptionsMsg.Code)
- {
- case 0:
- TempOptions.PostOpts.depth = 1;
- break;
-
- case 1:
- TempOptions.PostOpts.depth = 3;
- break;
-
- case 2:
- TempOptions.PostOpts.depth = 4;
- break;
- }
- return(0);
- }
-
- int OptPrDenClicked( void )
- {
- /* routine when gadget "_Printer Density" is clicked. */
-
- TempOptions.PostOpts.prden = OptionsMsg.Code+1;
- return(0);
- }
-
- int OptIffClicked( void )
- {
- /* routine when gadget "_IFF File Name" is clicked. */
-
- strcpy(TempOptions.PostOpts.iffname, GetString(OptionsGadgets[GD_OptIff]));
- return(0);
- }
-
- int OptFromClicked( void )
- {
- /* routine when gadget "_From" is clicked. */
-
- TempOptions.PostOpts.from = GetNumber(OptionsGadgets[GD_OptFrom]);
- if(TempOptions.PostOpts.from < 1 || TempOptions.PostOpts.from > number_of_pages)
- {
- TempOptions.PostOpts.from = 1;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptFrom], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.from, TAG_DONE);
- ActivateGadget(OptionsGadgets[GD_OptFrom], OptionsWnd, NULL);
- }
- else ActivateGadget(OptionsGadgets[GD_OptTo], OptionsWnd, NULL);
- return(0);
- }
-
- int OptToClicked( void )
- {
- /* routine when gadget "To" is clicked. */
-
- TempOptions.PostOpts.to = GetNumber(OptionsGadgets[GD_OptTo]);
- if(TempOptions.PostOpts.to < 1 || TempOptions.PostOpts.to > number_of_pages || TempOptions.PostOpts.to < TempOptions.PostOpts.from)
- {
- TempOptions.PostOpts.to = number_of_pages;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptTo], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.to, TAG_DONE);
- ActivateGadget(OptionsGadgets[GD_OptTo], OptionsWnd, NULL);
- }
- return(0);
- }
-
- int OptAllPagesClicked( void )
- {
- /* routine when gadget "_All Pages" is clicked. */
-
- doopts_allpages();
- return(0);
- }
-
- int OptGetIffClicked( void )
- {
- /* routine when gadget "" is clicked. */
-
- if (opt_number != MENU_IFF) return(0);
- if (AslRequestTags(fontrequester,
- ASLFR_InitialPattern, (ULONG) "",
- ASLFR_InitialDrawer, (ULONG) "",
- ASLFR_InitialFile, (ULONG) TempOptions.PostOpts.iffname,
- ASLFR_InitialHeight, 300,
- ASLFR_TitleText, (ULONG) "Select iff-file",
- ASLFR_DoSaveMode, FALSE,
- ASLFR_Window, (ULONG) OutputWnd,
- TAG_DONE) == NULL) return(0);
- strcpy(undobuff, fontrequester->rf_Dir);
- if(AddPart(undobuff, fontrequester->rf_File, MAXFILENAME) == FALSE) return(0);
- strcpy(TempOptions.PostOpts.iffname, undobuff);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptIff], OptionsWnd, NULL,
- GTST_String, (ULONG) &(TempOptions.PostOpts.iffname), TAG_DONE);
- return(0);
- }
-
- int OptFFClicked( void )
- {
- /* routine when gadget "_FormFeed" is clicked. */
-
- TempOptions.PostOpts.formfeed = !TempOptions.PostOpts.formfeed;
- return(0);
- }
-
- int OptCenterClicked( void )
- {
- /* routine when gadget "_CenterPage" is clicked. */
-
- TempOptions.PostOpts.centerpage = !TempOptions.PostOpts.centerpage;
- return(0);
- }
-
- int OptBandClicked( void )
- {
- /* routine when gadget "_Bandsize" is clicked. */
-
- TempOptions.PostOpts.bandsize = GetNumber(OptionsGadgets[GD_OptBand]);
- return(0);
- }
-
- int OptBandrenderClicked( void )
- {
- /* routine when gadget "_Bandrendering" is clicked. */
-
- doopts_band();
- return(0);
- }
-
- int OptGraphiccardClicked( void )
- {
- /* routine when gadget "Path" is clicked. */
-
- TempOptions.graphiccard = !TempOptions.graphiccard;
- return(0);
- }
-
- int OptBufferClicked( void )
- {
- /* routine when gadget "Buffer" is clicked. */
-
- if (GetNumber(OptionsGadgets[GD_OptBuffer]) >= BUFSIZ)
- TempOptions.bufsize = GetNumber(OptionsGadgets[GD_OptBuffer]);
- else
- {
- TempOptions.bufsize = BUFSIZ;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBuffer], OptionsWnd, NULL,
- GTIN_Number, BUFSIZ, TAG_DONE);
- ActivateGadget(OptionsGadgets[GD_OptBuffer], OptionsWnd, NULL);
- }
- return(0);
- }
-
- int OptTemppathClicked( void )
- {
- /* routine when gadget "Path" is clicked. */
-
- strcpy(TempOptions.temppath, GetString(OptionsGadgets[GD_OptTemppath]));
- delete_tempfiles();
- return(0);
- }
-
- int OptionsCloseWindow( void )
- {
- /* routine for "IDCMP_CLOSEWINDOW". */
-
- return(Options_CANCEL);
- }
-
- int OptionsVanillaKey( void )
- {
- /* routine for "IDCMP_VANILLAKEY". */
-
-
- switch (OptionsMsg.Code)
- {
- case 'c':
- case 'C':
- return(Options_CANCEL);
-
- case 'u':
- case 'U':
- SavePostOptions(useopts[opt_number], &TempOptions);
- return(Options_OK);
-
- case 's':
- case 'S':
- SavePostOptions(saveopts[opt_number], &TempOptions);
- SavePostOptions(useopts[opt_number], &TempOptions);
- return(Options_OK);
-
- case 'w':
- case 'W':
- ActivateGadget(OptionsGadgets[GD_OptWidth], OptionsWnd, NULL);
- break;
-
- case 'b':
- case 'B':
- TempOptions.PostOpts.depth = 1;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptColor], OptionsWnd, NULL,
- GTMX_Active, 0, TAG_DONE);
- break;
-
- case 'r':
- case 'R':
- TempOptions.PostOpts.depth = 3;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptColor], OptionsWnd, NULL,
- GTMX_Active, 1, TAG_DONE);
- break;
-
- case 'm':
- case 'M':
- TempOptions.PostOpts.depth = 4;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptColor], OptionsWnd, NULL,
- GTMX_Active, 2, TAG_DONE);
- break;
-
- case 'a':
- case 'A':
- if (opt_number == MENU_NEW) break;
- doopts_allpages();
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptAllPages], OptionsWnd, NULL,
- GTCB_Checked, TempOptions.PostOpts.allpages, TAG_DONE);
- break;
-
- case 'd':
- case 'D':
- if (opt_number == MENU_NEW) break;
- doopts_band();
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBandrender], OptionsWnd, NULL,
- GTCB_Checked, TempOptions.PostOpts.bandrendering, TAG_DONE);
- break;
-
- default:
- break;
- }
- return(0);
- }
-
- void setoptionsgadgets(int mode)
- {
- int mx;
-
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptWidth], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.width, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptHeight], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.height, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptXOff], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.xoff, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptYOff], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.yoff, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptXDPI], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.xdpi, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptYDPI], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.ydpi, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptFonts], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.fonts, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptHtone], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.htone, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptVM], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.vm, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptPaths], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.paths, TAG_DONE);
-
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBand], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.bandsize, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptFrom], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.from, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptTo], OptionsWnd, NULL,
- GTIN_Number, TempOptions.PostOpts.to, TAG_DONE);
-
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptPrDen], OptionsWnd, NULL,
- GTCY_Active, TempOptions.PostOpts.prden-1, TAG_DONE);
-
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptFF], OptionsWnd, NULL,
- GTCB_Checked, TempOptions.PostOpts.formfeed, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptCenter], OptionsWnd, NULL,
- GTCB_Checked, TempOptions.PostOpts.centerpage, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptAllPages], OptionsWnd, NULL,
- GTCB_Checked, TempOptions.PostOpts.allpages, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBandrender], OptionsWnd, NULL,
- GTCB_Checked, TempOptions.PostOpts.bandrendering, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptIff], OptionsWnd, NULL,
- GTST_String, (ULONG) &(TempOptions.PostOpts.iffname), TAG_DONE);
-
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptGraphiccard], OptionsWnd, NULL,
- GTCB_Checked, TempOptions.graphiccard, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBuffer], OptionsWnd, NULL,
- GTIN_Number, TempOptions.bufsize, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptTemppath], OptionsWnd, NULL,
- GTST_String, (ULONG) &(TempOptions.temppath), TAG_DONE);
-
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptStartUp], OptionsWnd, NULL,
- GTLV_Labels, (ULONG) &(TempOptions.startuplist), GTLV_Selected, init_selected, GTLV_Top, init_selected, TAG_DONE);
-
- if(number_of_pages)
- {
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptAllPages], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBandrender], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- if(TempOptions.PostOpts.bandrendering)
- {
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBand], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- }
- if(TempOptions.PostOpts.allpages == FALSE)
- {
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptFrom], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptTo], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- }
- }
- if(TempOptions.PostOpts.depth == 1) mx = 0;
- else if(TempOptions.PostOpts.depth == 3) mx = 1;
- else mx = 2;
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptColor], OptionsWnd, NULL,
- GTMX_Active, mx, TAG_DONE);
- }
-
- void LoadPostOptions(char *name, struct Options *opts)
- {
- FILE *datei;
- char buffer[256];
- char *pointer;
- int i;
- struct Options loadedopts;
- struct startupnode *startupnode;
- extern int errno;
-
- if((datei = fopen(name, "r")) == NULL)
- {
- sprintf(buffer, "can't open '%s'!", name);
- okmsg(buffer);
- return;
- }
-
- pointer = (char *) &loadedopts;
- errno = 0;
- for(i=0; i < sizeof(struct Options); i++)
- {
- if(((*pointer) = fgetc(datei)) == EOF)
- {
- if(errno)
- {
- fclose(datei);
- okmsg("unexpected end of file!");
- return;
- }
- }
- pointer++;
- }
- if(strcmp("POST", (char *) &loadedopts) || loadedopts.chk != sizeof(struct Options))
- {
- sprintf(buffer, "file '%s' is not a valid options file!", name);
- okmsg(buffer);
- fclose(datei);
- return;
- }
- free_list(&opts->startuplist);
- *opts = loadedopts;
- NewList(&opts->startuplist);
- max_selected = -1;
- init_selected = -1;
- node_selected = NULL;
- while(fgets(buffer, 256, datei))
- {
- buffer[strlen(buffer)-1] = '\0';
- if(startupnode = (struct startupnode *) malloc(sizeof(struct startupnode)))
- {
- strcpy(startupnode->name, buffer);
- startupnode->linknode.ln_Name = startupnode->name;
- AddTail(&opts->startuplist, (struct Node *) startupnode);
- node_selected = (struct Node *) startupnode;
- max_selected++;
- init_selected++;
- /* sprintf(undobuff, "init = %d, max = %d, node = %lx",
- init_selected, max_selected, node_selected);
- okmsg(undobuff);*/
- }
- }
- fclose(datei);
- }
-
- void SavePostOptions(char *name, struct Options *opts)
- {
- FILE *datei;
- char buffer[256];
- char *pointer;
- int i;
- struct Node *node;
-
- if((datei = fopen(name, "w")) == NULL)
- {
- sprintf(buffer, "can't open '%s'!", name);
- okmsg(buffer);
- return;
- }
- pointer = (char *) opts;
- for(i=0; i < sizeof(struct Options); i++)
- {
- if(fputc((*pointer), datei) == EOF)
- {
- fclose(datei);
- sprintf(buffer, "can't write to '%s'!", name);
- okmsg(buffer);
- return;
- }
- pointer++;
- }
- for(node = opts->startuplist.lh_Head; node->ln_Succ; node = node->ln_Succ)
- {
- sprintf(buffer, "%s\n", node->ln_Name);
- if(fputs(buffer, datei))
- {
- fclose(datei);
- sprintf(buffer, "can't write to '%s'!", name);
- okmsg(buffer);
- break;
- }
- }
- fclose(datei);
- }
-
- int OptionsMenuOpen( void )
- {
- /* routine when (sub)item "Open ..." is selected. */
-
- if (AslRequestTags(fontrequester,
- ASLFR_InitialPattern,(ULONG) "",
- ASLFR_InitialDrawer, (ULONG) "ENVARC:",
- ASLFR_InitialFile, (ULONG) "",
- ASLFR_InitialHeight, 300,
- ASLFR_TitleText, (ULONG) "Select options-file to load",
- ASLFR_DoSaveMode, FALSE,
- ASLFR_Window, (ULONG) OutputWnd,
- TAG_DONE) == NULL) return(0);
- strcpy(undobuff, fontrequester->rf_Dir);
- if(AddPart(undobuff, fontrequester->rf_File, MAXFILENAME) == FALSE) return(0);
- LoadPostOptions(undobuff, &TempOptions);
- setoptionsgadgets(0);
- return(0);
- }
-
- int OptionsMenuSave( void )
- {
- /* routine when (sub)item "Save As ..." is selected. */
-
- if (AslRequestTags(fontrequester,
- ASLFR_InitialPattern,(ULONG) "",
- ASLFR_InitialDrawer, (ULONG) "ENVARC:",
- ASLFR_InitialFile, (ULONG) "",
- ASLFR_InitialHeight, 300,
- ASLFR_TitleText, (ULONG) "Select options-file to save",
- ASLFR_DoSaveMode, TRUE,
- ASLFR_Window, (ULONG) OutputWnd,
- TAG_DONE) == NULL) return(0);
- strcpy(undobuff, fontrequester->rf_Dir);
- if(AddPart(undobuff, fontrequester->rf_File, MAXFILENAME) == FALSE) return(0);
- SavePostOptions(undobuff, &TempOptions);
- return(0);
- }
-
- int OptionsMenuDefaults( void )
- {
- /* routine when (sub)item "Reset To Defaults" is selected. */
-
- copy_options(&TempOptions, &DefaultOptions);
- /* NewList(&(TempOptions.startuplist));
- max_selected = -1;
- init_selected = -1;
- node_selected = NULL;
- for(node = DefaultOptions.startuplist.lh_Head; node->ln_Succ; node = node->ln_Succ)
- {
- if(startupnode = (struct startupnode *) malloc(sizeof(struct startupnode)))
- {
- strcpy(startupnode->name, node->ln_Name);
- startupnode->linknode.ln_Name = startupnode->name;
- node_selected = (struct Node *) startupnode;
- max_selected++;
- init_selected++;
- AddTail(&(TempOptions.startuplist), (struct Node *) startupnode);
- }
- }*/
- setoptionsgadgets(0);
- return(0);
- }
-
- int OptionsMenuLastSaved( void )
- {
- /* routine when (sub)item "Last Saved" is selected. */
-
- LoadPostOptions(saveopts[opt_number], &TempOptions);
- setoptionsgadgets(0);
- return(0);
- }
-
-
- void init_list(struct List *list)
- {
- struct startupnode *startupnode;
-
- NewList(list);
- if(startupnode = (struct startupnode *) malloc(sizeof(struct startupnode)))
- {
- strcpy(startupnode->name, STD_STARTUP);
- startupnode->linknode.ln_Name = startupnode->name;
- AddTail(list, (struct Node *) startupnode);
- }
- max_selected = 0;
- init_selected = 0;
- node_selected = (struct Node *) startupnode;
- }
-
- void free_list(struct List *list)
- {
- struct Node *node, *nextnode;
-
- for(node = list->lh_Head; node->ln_Succ;)
- {
- nextnode=node->ln_Succ;
- free(node);
- node=nextnode;
- }
- NewList(list);
- }
-
- void copy_options(struct Options *to, struct Options *from)
- {
- struct Node *node;
- struct startupnode *startupnode;
-
- *to = *from;
- NewList(&(to->startuplist));
- max_selected = -1;
- init_selected = -1;
- node_selected = NULL;
- for(node = from->startuplist.lh_Head; node->ln_Succ; node = node->ln_Succ)
- {
- if(startupnode = (struct startupnode *) malloc(sizeof(struct startupnode)))
- {
- strcpy(startupnode->name, node->ln_Name);
- startupnode->linknode.ln_Name = startupnode->name;
- node_selected = (struct Node *) startupnode;
- max_selected++;
- init_selected++;
- AddTail(&(to->startuplist), (struct Node *) startupnode);
- }
- }
- }
-
- void doopts_band(void)
- {
- TempOptions.PostOpts.bandrendering = !TempOptions.PostOpts.bandrendering;
- if(TempOptions.PostOpts.bandrendering)
- {
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBand], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- ActivateGadget(OptionsGadgets[GD_OptBand], OptionsWnd, NULL);
- }
- else
- {
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptBand], OptionsWnd, NULL,
- GA_Disabled, TRUE, TAG_DONE);
- }
- }
-
- void doopts_allpages(void)
- {
- TempOptions.PostOpts.allpages = !TempOptions.PostOpts.allpages;
- if(TempOptions.PostOpts.allpages == FALSE)
- {
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptFrom], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptTo], OptionsWnd, NULL,
- GA_Disabled, FALSE, TAG_DONE);
- ActivateGadget(OptionsGadgets[GD_OptFrom], OptionsWnd, NULL);
- }
- else
- {
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptFrom], OptionsWnd, NULL,
- GA_Disabled, TRUE, TAG_DONE);
- GT_SetGadgetAttrs(OptionsGadgets[GD_OptTo], OptionsWnd, NULL,
- GA_Disabled, TRUE, TAG_DONE);
- }
- }
-